<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>SQL Fiddle</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Application for testing and sharing SQL queries.">
    <meta name="author" content="Jake Feasel">
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

    <link rel="stylesheet" type="text/css" href="css/styles_min.css">
    <link rel="stylesheet" type="text/css" href="css/print_min.css" media="print" />



<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-28576776-1']);
  _gaq.push(['_setDomainName', 'sqlfiddle.com']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
<body>
    <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <a class="brand" href=".">SQL Fiddle<img src="images/fiddle_transparent_small.png" style="height: 20px;margin-top: -10px;"> </a>
                <div class="nav-collapse">
                    <ul class="nav">
                        <li class="dropdown" id="db_type_id">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                Table of Contents <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li class="">
                                    <a href="#whatToDo">What am I supposed to do here?</a>
                                </li>
                                <li class="">
                                    <a href="#howWorks">How does it work?</a>
                                </li>
                                <li class="">
                                    <a href="#dbNotes">What differences are there between the various database options?</a>
                                </li>
                                <li>
                                    <a href="#terminators">What's up with that [ ; ] button under each panel?</a>
                                </li>
                                <li class="">
                                    <a href="#sqlite">Why are there two strange-looking options for SQLite?</a>
                                </li>
                                <li>
                                    <a href="#contact">Who should I contact for help/feedback?</a>
                                </li>
                                <li>
                                    <a href="#whoBuilt">Who built this site, and why?</a>
                                </li>
                                <li>
                                    <a href="#gettingPaid">How is the site paid for?</a>
                                </li>
                                <li>
                                    <a href="#source">Source Code</a>
                                </li>
                                <li>
                                    <a href="#platform">What platform is it running on?</a>
                                </li>
                            </ul>
                        </li>
                        <li class="divider-vertical"></li>
                        <li>
                            <a href="#source">
                                Source Code
                            </a>
                        </li>
                    </ul>
                    <ul class="nav pull-right">
                        <li>
                            <a href="."><i class="icon-info-sign"></i>Home</a>
                        </li>
                    </ul>
                </div>
                <ul class="nav pull-right" id="exit_fullscreen">
                    <li class="">
                        <a href="#"><span>Exit Fullscreen</span> <i class="icon-resize-small"></i></a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="row">
            <div class="span12" id="content">
                <!--
                <div class="span6 panel pull-left">
                </div>
                <div class="span6 panel pull-right">
                </div>
                -->
                <div class="span12 panel pull-left">
                    <div class="hero-unit">
                        <img class="pull-left" src="images/fiddle_transparent.png" title="A fiddle-head fern">
                        <div class="page-header pull-left">
                            <h1 class="">About SQLFiddle.com</h1>
                        </div>
                        <p>
                            A tool for easy online testing and sharing of database problems and their solutions.
                        </p>

                    </div>
                </div>

                <a name="whatToDo"></a>
                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>

                <div class="span9 panel pull-left">
                    <h2>What am I supposed to do here?</h2>
                        <p>
                            If you do not know SQL or basic database
                            concepts, this site is not going to be very useful to you.  However, if you are a database developer, there are a few
                            different use-cases of SQL Fiddle intended for you:
                        </p>

                    <p>
                        <span class="use_case">You want help with a tricky query, and you'd like to post a question to a Q/A site like
                        <a href="http://stackoverflow.com" title="Awesome Q &amp; A site"><span class="label label-info">StackOverflow</span></a>.</span>  Build a
                        representative database (schema and data) and post a link to it in your question.  Unique
                        URLs for each database (and each query) will be generated as you use the site; just copy and paste the
                        URL that you want to share, and it will be available for anyone who wants to take a look.  They will
                        then be able to use your DDL and your SQL as a starting point for answering your question.  When they
                        have something they'd like to share with you, they can then send you a link back to their query.
                    </p>
                    <p>
                        <span class="use_case">You want to compare and contrast SQL statements in different database back-ends.</span>  SQL Fiddle easily lets
                        you switch which database provider (MySQL, PostgreSQL, MS SQL Server, Oracle, and SQLite) your queries run
                        against.  This will allow you to quickly evaluate query porting efforts, or language options available
                        in each environment.
                    </p>
                    <p>
                        <span class="use_case">You do not have a particular database platform readily available, but you would like to see what a given
                        query would look like in that environment.</span>  Using SQL Fiddle, you don't need to bother spinning up a
                        whole installation for your evaluation; just create your database and queries here!
                    </p>
                </div>
                <div class="span3 panel pull-right">
                    <div class="thumbnail">
                        <div class="image">
                            <iframe width="270" height="180" src="http://www.youtube.com/embed/DDVOMRvyAS4?rel=0" frameborder="0" allowfullscreen></iframe>
                        </div>
                        <div class="caption">
                            <h5>SQL Fiddle : SQL Online Practice Tool</h5>
                            <p>
                                <a href="http://allzhere.in/2013/03/12/sql-fiddle-runexecute-sql-online/" target="_blank"><span class="label">AllzHere</span></a> has made a nice <a href="http://youtu.be/DDVOMRvyAS4" target="_blank">instructional video</a> and <a href="http://allzhere.in/2013/03/12/sql-fiddle-runexecute-sql-online/" target="_blank">blog post</a> for getting started with SQL Fiddle.
                            </p>
                        </div>
                    </div>
                </div>

                <a name="howWorks"></a>

                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel">
                    <h2>How does it work?</h2>
                    <p>
                        The Schema DDL that is provided is used to generate a private database on the fly.  If anything is changed in your
                        DDL (even a single space!), then you will be prompted to generate a new schema and will be operating in a new database.

                    </p>
                    <p>
                        All SQL queries are run within a transaction that gets immediately rolled-back after the SQL executes.  This is so
                        that the underlying database structure does not change from query to query, which makes it possible to share anonymously
                        online with any number of users (each of whom may be writing queries in the same shared database, potentially modifying
                        the structure and thus -- if not for the rollback -- each other's results).
                    </p>
                    <p>
                        As you create schemas and write queries, unique URLs that refer to your particular schema and query will be
                        visible in your address bar.  You can share these with anyone, and they will be able to see what you've done
                        so far.  You will also be able to use your normal browser functions like 'back', 'forward', and 'reload', and you
                        will see the various stages of your work, as you would expect.

                    </p>
                </div>

                <a name="dbNotes"></a>

                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel">
                    <h2>What differences are there between the various database options?</h2>
                    <p>
                        Aside from the differences inherent in the various databases, there are a few things worth pointing out about their implementation on SQL Fiddle.
                    </p>

                    <p>
                        MySQL only supports queries which read from the schema (selects, basically).  This is necessary due to some limitations in MySQL that make it impossible for
                        me to ensure a consistent schema while various people are fiddling with it.  The other database options allow the full range of queries that the back-end supports.
                    </p>

                    <p>
                        Versions of various databases that are either older or newer than the current stable release for that product are hosted by <a href="http://douglastechnology.co.uk/">Jack Douglas</a> in his server
                        environment.  This means that some of the schema building / query execution actions may be a bit slower for these options, as there is more network latency between
                        my web server and his VMs.
                    </p>

                    <p>
                        SQLite runs in the browser; see below for more details.
                    <p>

                </div>

                <a name="terminators"></a>

                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel">
                    <h2>What's up with that [ ; ] button under each panel?</h2>
                    <p>
                        This obscure little button determines how the queries in each of the panels get broken up before they
                        are sent off to the database.  This button pops open a dropdown that lists different "query terminators."
                        Query terminators are used as a flag to indicate (when present at the end of a line) that the current statement
                        has ended.  The terminator does not get sent to the database; instead, it merely idicates how I should parse the
                        text before I execute the query.
                    </p>
                    <p>
                        Oftentimes, you won't need to touch this button; the main value this feature will have is in defining stored procedures.
                        This is because it is often the case that within a stored procedure's body definition, you might want to end a line with a
                        semicolon (this is often the case). Since my default query terminator is also a semicolon, there is no obvious way for me to
                        see that your stored procedure's semicolon isn't actually the end of the query.  Left with the semicolon terminator, I would break up your procedure
                        definition into incorrect parts, and errors would certainly result.  Changing the query terminator to something other
                        than a semicolon avoids this problem.
                    </p>
                </div>

                <a name="sqlite"></a>

                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel">
                    <h2>Why are there two strange-looking options for SQLite?</h2>
                    <p>
                        SQLite is something of a special case amongst the various database types I support.  I could have implemented it the same way as
                        the others, with a backend host doing the query execution, but what fun is that?  SQLite's "lite" nature allowed for some
                        interesting alternatives.

                    </p>
                    <p>
                        First, I found the very neat project
                        <a href="https://github.com/kripken/sql.js"><span class="label label-info">SQL.js</span></a>, which is an implementation of the engine translated into javascript.
                        This means that instead of using my servers (and my limited memory), I could offload the work onto your browser!  Great for me,
                        but unfortunately SQL.js does have a few drawbacks. One is that it taxes the browser a bit when it is first loaded into memory. The
                        other is that it doesn't work in all browsers (so far I've seen it fail in IE9 and mobile Safari).
                    </p>
                    <p>

                        The other option is "WebSQL."  This option makes use of the SQLite implementation that a few browsers come with built-in (I've seen it work in Chrome and Safari; supposedly Opera supports this too).  This feature
                        was considered part of the <a href="http://www.w3.org/TR/webdatabase/"><span class="label label-info">W3C working draft for HTML5</span></a>, but they depricated it in
                        favor of <a href="http://www.w3.org/TR/IndexedDB/"><span class="label label-info">IndexedDB</span></a>.  Despite this, a few browsers (particularly mobile browsers) still
                        have it available, so I figured that this would be a useful feature to grab onto.  The advantage over SQL.js is that it is quite a bit faster
                        to load the schema and run the queries.  The disadvantage is that it isn't widely supported, and likely not long for this world.

                    </p>
                    <p>
                        Together, these two options allow SQLite to run within any <i>decent</i> browser *cough*IE*cough*.  If someone links you to a SQLite fiddle
                        that your browser doesn't support, just switch over to the other option and build it using that one. If neither works, then get a better browser.
                    </p>
                </div>

                <a name="contact"></a>

                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel pull-right">
                    <h2>Who should I contact for help/feedback?</h2>
                    <p>
                        There are two ways you can get in contact:
                    </p>
                    <ul>
                        <li>Email : admin&lt;at&gt;sqlfiddle&lt;dot&gt;com</li>
                        <li>Twitter: <a href="https://twitter.com/#!/sqlfiddle"><span class="label label-info">@sqlfiddle</span></a></li>
                    </ul>
                </div>

                <a name="whoBuilt"></a>
                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel pull-left">

                    <h2>Who built this site, and why?</h2>
                    <p>
                        SQLFiddle.com was built by me, <a href="http://stackoverflow.com/users/808921/jake-feasel"><span class="label">Jake Feasel</span></a>,
                        a web developer originally from Anchorage, Alaska and now living in Vancouver, WA.  I started developing the site around the middle of January, 2012.
                    </p>
                    <p>
                        I had been having fun answering questions on StackOverflow, particularly related to a few main categories:
                        <a href="http://stackoverflow.com/search?q=user:808921+[coldfusion]"><span class="label label-warning">ColdFusion</span></a>,
                        <a href="http://stackoverflow.com/search?q=user:808921+[jquery]"><span class="label label-warning">jQuery</span></a>, and
                        <a href="http://stackoverflow.com/search?q=user:808921+[sql]"><span class="label label-warning">SQL</span></a>.
                    </p>
                    <p>
                        <a href="http://stackoverflow.com/users/808921/jake-feasel">
                            <img src="http://stackoverflow.com/users/flair/808921.png" width="208" height="58" alt="profile for Jake Feasel at Stack Overflow, Q&amp;A for professional and enthusiast programmers" title="profile for Jake Feasel at Stack Overflow, Q&amp;A for professional and enthusiast programmers">
                        </a>
                    </p>
                    <p>
                        I found <a href="http://jsfiddle.net"><span class="label label-info">JS Fiddle</span></a> to be a great tool for answering javascript / jQuery questions,
                        but I also found that there was nothing available that offered similar functionality for the SQL questions. So, that
                        was my inspiration to build this site.  Basically, I built this site as a tool for developers like me to be more
                        effective in assisting other developers.
                    </p>
                    <p>
                        <a href="http://ramonroche.com/"><span class="label label-info">Ramon Roche</span></a> helped me to get the UI moved to Bootstrap, and just generally helped to make it look a lot better.
                        This has been my first time using Bootstrap, and without his assistance getting started I'm sure it would have been a lot rougher.  Thanks Ramon!
                    </p>



                </div>


                <a name="gettingPaid"></a>
                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel pull-left">

                    <h2>How is the site paid for?</h2>
                    <p>
                        Originally, my costs for operating this site were very low - basically, I had a free ride on the cloud hosting environment purchased by my former employer, <a href="http://www.geonorth.com">GeoNorth</a>.
                        However, as I moved on to <a href="http://www.forgerock.com">different employment</a>, I knew I would no longer have this luxury.  Fortunately, the site has had enough usage since it's initial rollout to
                        gain a sponsor's interest.  So, thanks to the very good folks at <a href="http://www.sqlsentry.com">SQL Sentry</a>, I am able to cover the costs of running this site.
                    </p>

                    <p>
                        Sponsorship aside, server memory is still tight and I would like to expand. If you would like to help me run this site, then you have several options to do so.
                        First, you could visit SQL Sentry by clicking on the ad on the bottom of the main page, and try out their products.  Second, you can click on the <a href="http://flattr.com/thing/679503/SQL-Fiddle">Flattr link</a>
                        at the top of the page and kick me a little micro-donation.  Flattr is a new service so I know a lot of people haven't started using it yet; if you're
                        more comfortable with PayPal, and would like to help me out with running the site that way, I'd really love to have your support.  My <i>admin at sqlfiddle dot com</i> address
                        is hooked up with PayPal, so please feel free to help me out that way.
                    </p>

                    <p>
                        One of the biggest contributors I have for the site is <a href="http://douglastechnology.co.uk/">Jack Douglas</a>, from <a href="http://dba.stackexchange.com">dba.stackexchange.com</a>.  Jack has provided many of the
                        VPS instances that I'm using to run the non-primary versions of various databases.  Thanks Jack!
                    </p>

                </div>

                <a name="source"></a>

                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel pull-left">
                    <h2>Source Code</h2>
                    <p>
                        If you are interested in the fine details of the code behind SQL Fiddle, it is all available on <a href="https://github.com/jakefeasel/sqlfiddle2"><span class="label label-info">github</span></a>
                    </p>
                </div>

                <a name="platform"></a>
                <div class="span12 pull-left hr-bar">
                    <hr>
                </div>
                <div class="span12 panel">
                    <h2>What platform is it running on?</h2>
                    <p>
                        This site uses many different technologies.  The primary ones used to provide the core service, in order from client to server are these:
                    </p>
                    <table class="table table-striped table-bordered table-condensed">
                        <thead>
                            <tr>
                                <th>Title</th>
                                <th>Description</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <th>
                                    <a href="http://requirejs.org/">RequireJS</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    JavaScript module loader and code optimizer.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://www.codemirror.net">CodeMirror</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    For browser-based SQL editing with text highlighting.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://getbootstrap.com/2.3.2/">Bootstrap</a> <span class="badge badge-warning">css</span>
                                </th>
                                <td>
                                    Twitter's CSS framework (v2).
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://lesscss.org/">LESS</a> <span class="badge badge-warning">css</span>
                                <td>
                                    CSS pre-processor.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://backbonejs.org/">Backbone.js</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    MV* JavaScript framework.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://handlebarsjs.com/">Handlebars.js</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    JavaScript templating engine.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="https://lodash.com/">Lodash.js</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    Functional programming library for Javascript.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://blog.stevenlevithan.com/archives/date-time-format">Date.format.js</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    Date formatting JavaScript library.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://jquery.com">jQuery</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    AJAX, plus misc JS goodness. (Also jq plugins <a href="http://malsup.com/jquery/block/"><span class="label label-success">Block UI</span></a> and <a href="https://github.com/carhartl/jquery-cookie"><span class="label label-success">Cookie</span></a>).
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://code.google.com/p/html-query-plan/">html-query-plan</a> <span class="badge badge-success">js</span>
                                </th>
                                <td>
                                    XSLT for building rich query plans for SQL Server.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="https://forgerock.org/openidm/">OpenIDM</a> <span class="badge badge-info">backend</span>
                                </th>
                                <td>
                                    Open Source Java-based Application Server.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="https://www.varnish-cache.org/">Varnish</a> <span class="badge badge-info">backend</span>
                                </th>
                                <td>
                                    Content-caching reverse proxy.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://www.postgresql.org">PostgreSQL</a> <span class="badge badge-inverse">db</span>
                                </th>
                                <td>
                                    Among others, of course, but PG is the central database host for this platform.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://www.ubuntu.com/">Ubuntu</a> <span class="badge badge-inverse">os</span>
                                </th>
                                <td>
                                    Linux distribution.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://aws.amazon.com">Amazon AWS</a> <span class="badge badge-inverse">hosting</span>
                                </th>
                                <td>
                                    VPS Cloud Hosting Provider.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://gruntjs.com/">Grunt</a> <span class="badge badge-important">devops</span>
                                </th>
                                <td>
                                    Javascript task runner, config and frontend build automation.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://maven.apache.org/">Maven</a> <span class="badge badge-important">devops</span>
                                </th>
                                <td>
                                    Dependency management, backend build automation.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="http://www.vagrantup.com/">Vagrant</a> <span class="badge badge-important">devops</span>
                                </th>
                                <td>
                                    VM management.
                                </td>
                            </tr>
                            <tr>
                                <th>
                                    <a href="https://github.com/jakefeasel/sqlfiddle2">GitHub</a> <span class="badge badge-important">devops</span>
                                </th>
                                <td>
                                    Git repository, collaboration environment.
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="alert alert-info">
                          <p>
                            <i class="icon-search icon-info-sign"></i> This list doesn't include the stacks used to run the database engines.  Those are pretty standard installs of the various products.  For example, I'm running a Windows 2008 VPS running SQL Server 2014 and Oracle, and various Ubuntu VPS instances running the others.
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="javascript/libs/jquery/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="javascript/libs/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>
